package fr.ensisa.hassenforder.game.client;

import java.io.OutputStream;

import fr.ensisa.hassenforder.network.BasicAbstractWriter;
import fr.ensisa.hassenforder.network.Protocol;

public class Writer extends BasicAbstractWriter {

	public Writer(OutputStream outputStream) {
		super (outputStream);
	}
	
    public void createConnection(String login,String password)
    {
    	writeInt(Protocol.REQU_CONNECT);
    	writeString(login);
    	writeString(password);
    }
    public void createDisconnection(String name,long id)
    {
    	writeInt(Protocol.REQU_DISCONNECT);
    	writeString(name);
    	writeLong(id);
    }
     public void createGetStatistique(String name,long id)
     {
    	 writeInt(Protocol.REQU_STRATISTIQUE);
    	 writeString(name);
      	 writeLong(id);
    	
     }
     public void createAddCash( String name,long id,int amount)
     {
    	 writeInt(Protocol.REQU_ADD_CASH);
    	 writeString(name);
      	 writeLong(id);
      	writeInt(amount);
      	System.out.println("montant envoye"+amount);
     }
     public void creatGetImage(String image)
     {
    	 writeInt(Protocol.REQU_PICTURE);
    	 writeString(image);
     }
     public void creatGetProducts(String name,long id)
     {
    	 writeInt(Protocol.REQU_PRODUCTS);
    	 writeString(name);
    	 writeLong(id);
     }
     public void creatGetShop(String name,long id)
     {
    	 writeInt(Protocol.REQU_SHOP);
    	 writeString(name);
    	 writeLong(id);
     }

	public void creatRefreshShops(String name, long id) 
	{
		 writeInt(Protocol.REQU_REFRESH);
    	 writeString(name);
    	 writeLong(id);
		
	}

	public void creatBuy(String name, long id, String productName) {
		writeInt(Protocol.REQU_BUY);
   	 writeString(name);
   	 writeLong(id);
   	writeString(productName);
		
	}

	public void creatSell(String name, long id, String productName) {
		writeInt(Protocol.REQU_SELL);
	   	 writeString(name);
	   	 writeLong(id);
	   	writeString(productName);
		
	}
	public void creatConsume(String name, long id) 
	{
		 writeInt(Protocol.REQU_CONSUME);
    	 writeString(name);
    	 writeLong(id);
		
	}

	public void creatClear(String name, long id) 
	{
		 writeInt(Protocol.REQU_CLEAR);
    	 writeString(name);
    	 writeLong(id);
		
	}
	

}
